﻿using System.Collections.Generic;
using System.Linq;
using ZilLion.Service.Core.DapperWrapper;
using ZilLion.Service.Core.DapperWrapper.SqlServer;
using ZilLion.Service.WeChatMall.Domain.Entitys.ShopInfo;
using ZilLion.Service.WeChatMall.Domain.Repositorys.Interface.ShopInfo;

namespace ZilLion.Service.WeChatMall.Domain.Repositorys.ShopInfo
{
    public class OfflineShopReponsitory : SqlServerRespository<OfflineShopEntity>,
        IOfflineShopReponsitory
    {
        public OfflineShopReponsitory()
        {
            Context = new WechatMallContext();
        }

        public IList<OfflineShopEntity> GetAll()
        {
            return GetAll().ToList();
        }

        public IList<OfflineShopEntity> GetImportableShop(string zlcompanykey)
        {
            var querysql = DapperHelper.CreateColSqlByMap<OfflineShopEntity>();
            var list = GetList($@"SELECT {querysql} FROM  waibztjga 
            WHERE fzjgid  NOT IN (SELECT offlineshopid FROM  offlineshoprelationship 
            WHERE zlcompanykey=@zlcompanykey)", new {zlcompanykey}).ToList();
            return list;
        }
    }
}